package org.dromara.web.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.web.domain.entity.Host;
import org.dromara.web.service.HostService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequiredArgsConstructor
@RestController
@RequestMapping("/host")
public class HostController {

    private final HostService hostService;

    @GetMapping("/list")
    public R<List<Host>> list() {
        return R.ok(hostService.list());
    }

    @PostMapping("/edit")
    public R<Boolean> edit(@RequestBody Host host) {
        return R.ok(hostService.updateById(host));
    }

    @DeleteMapping("/remove")
    public R<Boolean> remove(Long id) {
        return R.ok(hostService.removeById(id));
    }

    @DeleteMapping("/terminal")
    public R<Boolean> terminal(Long id) {
        return R.ok();
    }
}
